﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace WebApplication6
{
    public partial class WebForm1 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                DropDownList1.Items.Add("福建");
                DropDownList1.Items.Add("湖北");
                DropDownList1.Items.Add("江西");
                DropDownList2.Items.Add("宁德");
                DropDownList2.Items.Add("厦门");
                DropDownList2.Items.Add("南平");
            }
        }

        protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
        {
            string provice = DropDownList1.SelectedValue;
            DropDownList2.Items.Clear();

            if (provice == "福建")
            {
                DropDownList2.Items.Add("宁德");
                DropDownList2.Items.Add("厦门");
                DropDownList2.Items.Add("南平");
            }
            if (provice == "湖北")
            {
                DropDownList2.Items.Add("武汉");
                DropDownList2.Items.Add("宜昌");
                DropDownList2.Items.Add("黄冈");
            }
            if (provice == "江西")
            {
                DropDownList2.Items.Add("上饶");
                DropDownList2.Items.Add("南昌");
                DropDownList2.Items.Add("九江");
            }
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            if (ful.HasFile)
            {
                string fileName = ful.FileName;
                if (fileName.EndsWith(".jpg") || fileName.EndsWith(".png") || fileName.EndsWith(".jpeg"))
                {
                    string url = Server.MapPath("/img/" + fileName);
                    ful.SaveAs(url);
                    Image1.ImageUrl = "/img/" + fileName;
                    Image1.Visible = true;
                }
                else
                {

                }
            }
            else
            {

            }
            this.Label6.Text = $"用户名,{TextBox1.Text},密码,{TextBox2.Text},性别,{RadioButtonList1.SelectedValue},爱好,{TextBox3.Text},籍贯：{DropDownList1.SelectedValue}省,{DropDownList2.SelectedValue}市,其他信息,{TextBox4.Text},头像,{Image1.ImageUrl}";
        }

   
    }
}